<?php
class CMSException
{

	public $message;
	public $errCode;

	public function __construct($errCode,$message)
	{
		$this->errCode = $errCode;
		$this->message = $message;
	}

	public function getArray()
	{
		return array('errCode'=>$this->errCode,'message'=>$this->message);
	}

	public static $ok;
	public static $linkErr;
	public static $loginErr;
	public static $infoErr;
	public static $addModelErr;
	public static $deleteModelErr;
	public static $updateModelErr;
	public static $findModelErr;
	public static $addFieldErr;
	public static $deleteFieldErr;
	public static $updateFieldErr;
	public static $findFieldErr;

	public static $addCategoryErr;
	public static $updateCategoryErr;
	public static $deleteCategoryErr;

	public static $addDocumentErr;
	public static $updateDocumentErr;
	public static $deleteDocumentErr;

	public static $noCategoryErr;
	public static $noModelErr;
	public static $noFieldErr;
	public static $noDocumentErr;

}

CMSException::$ok             = (new CMSException('0','正常'))->getArray();
CMSException::$linkErr        = (new CMSException('1045','数据库连接失败,请验证数据库连接参数是否正确'))->getArray();
CMSException::$loginErr       = (new CMSException('1','用户名或者密码错误'))->getArray();

CMSException::$infoErr        = (new CMSException('2','用户名和密码不能为空'))->getArray();
CMSException::$addModelErr    = (new CMSException('3','添加模板错误,请验证模板名和数据表是否与数据库中已存在的模板名和数据表明有冲突。或者验证字段名和字段别名是否有重复的。'))->getArray();
CMSException::$deleteModelErr = (new CMSException('4','删除模板错误,不存在此id的模板'))->getArray();
CMSException::$updateModelErr = (new CMSException('5','修改模板错误,可能不存在此模板id或请验证模板名是否与其他模板重复了'))->getArray();
CMSException::$addFieldErr    = (new CMSException('6','添加字段错误,可能不存在此模板id或字段名和字段别名与其他字段重复了'))->getArray();
CMSException::$deleteFieldErr = (new CMSException('7','删除字段错误,不存在此id的模板'))->getArray();
CMSException::$updateFieldErr = (new CMSException('8','修改字段错误,可能不存在此字段id或字段名和字段别名与其他字段重复了'))->getArray();
CMSException::$findModelErr   = (new CMSException('9','查询模型出错'))->getArray();
CMSException::$findFieldErr   = (new CMSException('10','查询字段出错'))->getArray();

CMSException::$addCategoryErr	 	= (new CMSException('010', 'addCategoryErr'))->getArray();
CMSException::$deleteCategoryErr 	= (new CMSException('020','删除栏目出错'))->getArray();
CMSException::$updateCategoryErr 	= (new CMSException('030', '更新栏目出错'))->getArray();

CMSException::$addDocumentErr		= (new CMSException('001', 'addDocumentErr'))->getArray();
CMSException::$updateDocumentErr	= (new CMSException('002', 'updateDocumentErr'))->getArray();
CMSException::$deleteDocumentErr	= (new CMSException('003', 'deleteDocumentErr'))->getArray();

CMSException::$noCategoryErr 		= (new CMSEXception('100', 'noCategoryErr'))->getArray();
CMSException::$noModelErr 			= (new CMSException('200', 'noModelErr'))->getArray();
CMSException::$noFieldErr 			= (new CMSException('300', 'noFieldErr'))->getArray();
CMSException::$noDocumentErr 		= (new CMSException('400', 'noDocumentErr'))->getArray();	

